<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('生态日报表')"/>
    <th:block th:include="include :: layout-latest-css"/>
    <th:block th:include="include :: ztree-css"/>
</head>
<style>
    select {
        padding-top: 3px !important;
    }

    .select-list {
        margin-top: 5px !important;
    }

    .select-list li p {
        width: auto !important;
        margin-top: 7px !important;
    }

    .form-header {
        margin: 10px auto !important;

    }


</style>
<body class="gray-bg">
<div class="ui-layout-center">
    <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="project-form">
                    <div class="col-sm-12">
                        <div class="select-list">
                            <ul>
                                <li>
                                    <p>年份：</p>
                                    <select name="years" class="form-control">
                                        <option value="">请选择</option>
                                        <option value="2020">2020</option>
                                        <option value="2021">2021</option>
                                        <option value="2022">2022</option>
                                        <option value="2023">2023</option>
                                        <option value="2024">2024</option>
                                        <option value="2025">2025</option>
                                    </select>
                                </li>
                                <li>
                                    <p>月份：</p>
                                    <select name="months" class="form-control">
                                        <option value="">请选择</option>
                                        <option value="1">一月</option>
                                        <option value="2">二月</option>
                                        <option value="3">三月</option>
                                        <option value="4">四月</option>
                                        <option value="5">五月</option>
                                        <option value="6">六月</option>
                                        <option value="7">七月</option>
                                        <option value="8">八月</option>
                                        <option value="9">九月</option>
                                        <option value="10">十月</option>
                                        <option value="11">十一月</option>
                                        <option value="12">十二月</option>
                                    </select>
                                </li>
                                <li>
                                    <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                            class="fa fa-search"></i>&nbsp;搜索</a>
                                    <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                                            class="fa fa-refresh"></i>&nbsp;重置</a>
                                </li>
                            </ul>
                        </div>
                    </div>
                </form>
            </div>
            <div class="col-sm-12 select-table table-striped">

                <div class="btn-group-sm" id="toolbar" role="group">
                    <a class="btn btn-success"
                       onclick="$.modal.open('新增月数据',prefix_month+'/add?type=ecological')">
                        <i class="fa fa-plus"></i> 新增
                    </a>
                    <a class="btn btn-primary single disabled" onclick="edit();">
                        <i class="fa fa-edit"></i> 修改
                    </a>
                </div>
                <table id="bootstrap-table"></table>
            </div>

        </div>
    </div>
</div>

<th:block th:include="include :: footer"/>
<th:block th:include="include :: layout-latest-js"/>
<th:block th:include="include :: ztree-js"/>
<script th:inline="javascript">
    var prefix_day = ctx + 'EcologicalPark';
    var prefix_month = ctx + 'budget';
    var months_ID;
    $(function () {

        var options = {
            url: prefix_day + '/listMonth',
            uniqueId: "id",
            id: 'bootstrap-table',
            removeUrl: prefix_month + "/remove",
            updateUrl: prefix_month + "/edit/{id}",
            modalName: "生态园日报",
            showSearch: false,
            showRefresh: false,
            showToggle: false,
            showColumns: false,
            pagination: false,
            detailView: true,
            height: $(window).height()-140,
            detailFormatter: function (index, row, $detail) {
                initChildTable(index, row, $detail);
            },
            columns: [
                {
                    checkbox: true

                },
                {
                    field: 'id',
                    title: 'id',
                    align: "left",
                    visible: false
                },
                {
                    field: 'years',
                    title: '年份',
                    align: "left"
                },
                {
                    field: 'months',
                    title: '月份',
                    align: "left"
                },
                {
                    field: 'monthCountIncome',
                    title: '<div>营业总收入<br/>(本月累计收入)</div>',
                    align: "center"
                },
                {
                    field: 'lastYearCount',
                    title: '<div>营业总收入<br/>(上年同期月累计额)</div>',
                    align: "center"
                },
                {
                    field: 'completePercentage',
                    title: '<div>营业总收入<br/>(完成率)</div>',
                    align: "center"
                },
                {
                    field: 'monthlyBudget',
                    title: '<div>营业总收入<br/>(月度预算)</div>',
                    align: "center"
                },
                {
                    field: 'budgetCompletionRate',
                    title: '<div>营业总收入<br/>(预算完成率)</div>',
                    align: "center"
                },
                {
                    field: 'gdfyMonthCountIncome',
                    title: '<div>固定费用<br/>(本月累计收入)</div>',
                    align: "center"
                },
                {
                    field: 'gdfyLastYearCount',
                    title: '<div>固定费用<br/>(上年同期月累计额)</div>',
                    align: "center"
                },
                {
                    field: 'gdfyCompletePercentage',
                    title: '<div>固定费用<br/>(完成率)</div>',
                    align: "center"
                },
                {
                    field: 'gdfyMonthlyBudget',
                    title: '<div>固定费用<br/>(月度预算)</div>',
                    align: "center"
                },
                {
                    field: 'gdfyBudgetCompletionRate',
                    title: '<div>固定费用<br/>(预算完成率)</div>',
                    align: "center"
                },
                {
                    field: 'rlcbMonthCountIncome',
                    title: '<div>人力成本<br/>(本月累计收入)</div>',
                    align: "center"
                },
                {
                    field: 'rlcbLastYearCount',
                    title: '<div>人力成本<br/>(上年同期月累计额)</div>',
                    align: "center"
                },
                {
                    field: 'rlcbCompletePercentage',
                    title: '<div>人力成本<br/>(完成率)</div>',
                    align: "center"
                },
                {
                    field: 'rlcbMonthlyBudget',
                    title: '<div>人力成本<br/>(月度预算)</div>',
                    align: "center"
                },
                {
                    field: 'rlcbBudgetCompletionRate',
                    title: '<div>人力成本<br/>(预算完成率)</div>',
                    align: "center"
                },
                {
                    field: 'bdfyMonthCountIncome',
                    title: '<div>变动费用<br/>(本月累计收入)</div>',
                    align: "center"
                },
                {
                    field: 'bdfyLastYearCount',
                    title: '<div>变动费用<br/>(上年同期月累计额)</div>',
                    align: "center"
                },
                {
                    field: 'bdfyCompletePercentage',
                    title: '<div>变动费用<br/>(完成率)</div>',
                    align: "center"
                },
                {
                    field: 'bdfyMonthlyBudget',
                    title: '<div>变动费用<br/>(月度预算)</div>',
                    align: "center"
                },
                {
                    field: 'bdfyBudgetCompletionRate',
                    title: '<div>变动费用<br/>(预算完成率)</div>',
                    align: "center"
                },
                {
                    field: 'sdqnhMonthCountIncome',
                    title: '<div>水电气能耗<br/>(本月累计收入)</div>',
                    align: "center"
                },
                {
                    field: 'sdqnhLastYearCount',
                    title: '<div>水电气能耗<br/>(上年同期月累计额)</div>',
                    align: "center"
                },
                {
                    field: 'sdqnhCompletePercentage',
                    title: '<div>水电气能耗<br/>(完成率)</div>',
                    align: "center"
                },
                {
                    field: 'sdqnhMonthlyBudget',
                    title: '<div>水电气能耗<br/>(月度预算)</div>',
                    align: "center"
                },
                {
                    field: 'sdqnhBudgetCompletionRate',
                    title: '<div>水电气能耗<br/>(预算完成率)</div>',
                    align: "center"
                },
                {
                    field: 'lrMonthCountIncome',
                    title: '<div>利润<br/>(本月累计收入)</div>',
                    align: "center"
                },
                {
                    field: 'lrLastYearCount',
                    title: '<div>利润<br/>(上年同期月累计额)</div>',
                    align: "center"
                },
                {
                    field: 'lrCompletePercentage',
                    title: '<div>利润<br/>(完成率)</div>',
                    align: "center"
                },
                {
                    field: 'lrMonthlyBudget',
                    title: '<div>利润<br/>(月度预算)</div>',
                    align: "center"
                },
                {

                    title: '操作',
                    align: "left",
                    formatter: function (value, row, index) {
                        return '<a class="btn btn-success btn-xs" href="javascript:void(0)" onclick="$.modal.open(\'' + '添加日数据' + '\',\'' + prefix_day + '/add?monthId=' + row.id + '\',)"><i class="fa fa-edit"></i>添加</a> ';

                    }
                }
            ]

        }
        $.table.init(options);
    });

    function edit() {
        months_ID = $('#bootstrap-table').bootstrapTable('getSelections')[0].id;
        $.modal.open('修改月数据', prefix_month + '/edit/' + months_ID + "?type=ecological")
    }

    initChildTable = function (index, row, $detail) {
        var childTable = $detail.html('<table></table>').find('table');
        $(childTable).bootstrapTable({
            url: prefix_day + "/listDay",
            queryParams: {budgetId: row.id},
            method: 'post',
            uniqueId: row.id,
            sidePagination: "server",
            contentType: "application/x-www-form-urlencoded",
            columns: [{
                field: 'fillDay',
                title: '日',
                align: "center",

            },
                {
                    field: 'countIncome',
                    title: '营业总收入',
                    align: "center",
                },
                {
                    field: 'livestock',
                    title: '牲畜',
                    align: "center",
                },
                {
                    field: 'poultry',
                    title: '家禽',
                    align: "center",
                },
                {
                    field: 'vegetables',
                    title: '蔬菜',
                    align: "center",
                },
                {
                    field: 'beanProducts',
                    title: '豆制品',
                    align: "center",
                },
                {
                    field: 'aquaticProducts',
                    title: '水产',
                    align: "center",
                },
                {
                    field: 'purchasedProducts',
                    title: '外购产品',
                    align: "center",
                },
                {
                    field: 'amusement',
                    title: '果园',
                    align: "center",
                },
                {
                    field: 'orchard',
                    title: '游乐',
                    align: "center",
                },
                {
                    field: 'otherIncome',
                    title: '其他收入',
                    align: "center",
                },
                {
                    field: 'fixedCost',
                    title: '固定费用',
                    align: "center",
                },
                {
                    field: 'laborCost',
                    title: '人力成本',
                    align: "center",
                },
                {
                    field: 'rental',
                    title: '租赁费',
                    align: "center",
                },
                {
                    field: 'propertyManagement',
                    title: '物管费',
                    align: "center",
                },
                {
                    field: 'commonBear',
                    title: '低耗摊销',
                    align: "center",
                },
                {
                    field: 'assets',
                    title: '资产折旧',
                    align: "center",
                },
                {
                    field: 'variableCost',
                    title: '变动费用',
                    align: "center",
                },
                {
                    field: 'cost',
                    title: '成本',
                    align: "center",
                },
                {
                    field: 'waterAndElectricity',
                    title: '水电气能耗',
                    align: "center",
                },
                {
                    field: 'propaganda',
                    title: '广宣费',
                    align: "center",
                },
                {
                    field: 'other',
                    title: '其他',
                    align: "center",
                },
                {
                    field: 'profit',
                    title: '利润',
                    align: "center",
                },
                {
                    title: '操作',
                    align: "left",
                    formatter: function (value, row, index) {
                        return '<a class="btn btn-primary btn-xs" href="javascript:void(0)" onclick="$.modal.open(\'' + '修改日数据' + '\',\'' + prefix_day + '/edit/' + row.id + '\',)"><i class="fa fa-edit"></i>修改</a> ';

                    }
                }
            ]
        });
    }


</script>
</body>
</html>